package com.wgchao.identityrightsmanagement.domain.permission.model;

import com.wgchao.identityrightsmanagement.domain.IdentifiedDomainObject;
import lombok.Getter;
import java.util.HashSet;
import java.util.Set;

/**
 * @ClassName:OfficePermissionInformation
 * @author: wgchao
 * @createTime: 2020/6/28 3:57 PM
 * @Description: 职位权限信息
 */
@Getter
public class OfficePermissionInformation extends IdentifiedDomainObject {
    private PermissionIdentify identify;
    private String proMark;

    private Set<FunctionInformation> functions;

    public OfficePermissionInformation(String departmentCode, String officeCode, String proMark, String menuMark) {
        this.identify = new PermissionIdentify(departmentCode, officeCode, menuMark);
        this.proMark = proMark;
    }

    public OfficePermissionInformation(String departmentCode, String officeCode, String proMark, String menuMark, Set<FunctionInformation> functions) {
        this.identify = new PermissionIdentify(departmentCode, officeCode, menuMark);
        this.proMark = proMark;
        this.functions = functions;
    }

    public void addFunction(String menuMark, String funcMark){
        if(this.functions == null){
            this.functions = new HashSet<>();
        }
        this.functions.add(new FunctionInformation(menuMark, funcMark));
    }

}
